<%@ page isELIgnored="false" language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<script type="text/javascript">
    $(function(){
    	 var mabFlagVal = '${ json.mab}';
    	 mabFlagVal = eval('('+mabFlagVal+')');
    	 $('#mabFlag').combobox({
    		  onChange:function(newValue,oldValue){
    		    	 $('#sellTax').val(mabFlagVal[newValue].split('-')[1]);
    		  }
    	 });
    });
    function returnJson(){
    	var json = '${ code.mab}';
    	json = eval(json);
    	return json;
    }
    
	function changeCard(){
		if($('#eflag').val()=="true")
		{
			if($('#oldPasswordInput').val() =="" || $('#newPassword').val()=="" || $('#newPasswordRepeat').val()=="" )
			{
				$.messager.show({
				       title: '提示',
				       msg: "请输入密码",
				       timeout: 3000,
				       showType: 'slide'
				 });	
				return false;			   
			}
			if($('#newPassword').val() != $('#newPasswordRepeat').val() )
			{
				$.messager.show({
				       title: '提示',
				       msg: "密码不一致",
				       timeout: 3000,
				       showType: 'slide'
				 });	
				return false;			   
			}
		}
		var r = $('#abaForm').form('validate');
		if(!r) {
			return false;
		}
		//写卡
		if(!writeMoneyCard($('#money').val())) return;
		$.post("aba/cardChangeC",$("#abaForm").serializeArray(),function(data){
			if(data.mes=="1")
			{
				$.messager.alert('提示',"密码不一致",'info');
			}else
			{
				$('#MyPopWindow').window('close'); 
				$.messager.alert('提示',data.mes,'info');
				clearForm();
			}

		});
	}
	function readCardInfoNew(){
		var cardid = findNormalCard();
		if(cardid){
			$('#abaidNew').val(cardid);
			$('#cardkeyNew').val(findCard());
			return true;
		}return false;
	}
</script>
<form id="abaForm" method="post" style="margin: 10;text-align: center;">
    <input name="losted" type="hidden"/> 
    <input id="oldPassword" name="cardpassword" type="hidden"/> 
    <input id="userid" name="userid" type="hidden"/>
    <input id="version" name="version" type="hidden"/>
    <input id="eflag" name="eflag" type="hidden"/>
    <input id="moneycardlimit" name="moneycardlimit" type="hidden"/>
    <input id="emoney" name="emoney" type="hidden"/>
    <input id="money" name="money" type="hidden"/>
	<div style="background:#fafafa;">
		<table width="100%">
			<tr>
			 <td>基本资料</td>
			</tr>
		</table>
	</div>
	<div style="background:#fafafa;">
		<table width="100%">
           <tr><td>姓名：</td><td><input name="username" style="width: 200;border-style:none;background:#fafafa;" readonly="true" /> </td></tr>
		</table>
	</div>
	<div style="background:#fafafa;">
		<table width="100%">
			<tr>
			 <td>一卡通资料</td>
			</tr>
		</table>
	</div>
	<div style="background:#fafafa;">
		<table width="100%">
           <tr><td>一卡通卡号(原卡)</td><td>识别硬码</td><td>开卡日期</td><td>状态</td></tr>
           <tr>
           <td><input name="abaid" style="width: 100;border-style:none;background:#fafafa;" readonly="true"/></td>
           <td><input name="cardkey" style="width: 100;border-style:none;background:#fafafa;" readonly="true"/></td>
           <td><input name="creatdatetime" style="width: 100;border-style:none;background:#fafafa;" readonly="true"/></td>
           <td><input name="lostedText" style="width: 100;border-style:none;background:#fafafa;" readonly="true"/></td>
           </tr>

           <tr><td>一卡通卡号(新卡)</td><td>识别硬码</td><td>卡损坏原因</td>
               <td>手续费</td><td><a href="#" id="btn-readCard" onclick="readCardInfoNew()" class="easyui-linkbutton">读卡</a></td></tr>
           <tr>
           <td><input name="abaidNew" id="abaidNew" style="width: 100;" value="4567"/></td>
           <td><input name="cardkeyNew" id="cardkeyNew" style="width: 100;" value="2"/></td>
           <td><input id="mabFlag" name="mabFlag" value="2" class="easyui-combobox" style="width: 100;" editable="false" data-options="valueField: 'label',textField: 'value',
		data: returnJson()" /> </td>
           <td><input id="sellTax" name="sellTax" style="width: 100;border-style:none;background:#fafafa;" readonly="true" value="0"/></td>
           <td></td>
           </tr>
           
           <tr><td>原始密码</td><td>新密码</td><td>重复新密码</td><td>&nbsp;</td><td><a href="#" onclick="changeCard()" id="btn-changeCard" class="easyui-linkbutton">换卡</a></td></tr>
           <tr>
           <td><input id="oldPasswordInput" name="oldPasswordInput" style="width: 100"/></td>
           <td><input id="newPassword" name="newPassword" style="width: 100"/></td>
           <td><input id="newPasswordRepeat" name="newPasswordRepeat" style="width: 100"/></td>
           <td>&nbsp;</td>
           <td></td>
           </tr>                      
		</table>
	</div>
</form>